/**
 * Created by Administrator on 2017/5/30.
 */
$(document).ready(function () {
    $('#exercise-4 a').click(function (e) {
        e.preventDefault();
        $.getJSON($(this).attr('href') + '?callback=?', function (data) {
            var html = '';
            $.each(data.data, function (index, item) {
                html += '<div>';
                html += '<h3>' + item.id + '</h3>';
                html += '<div>' + item.name + '<div>';
                html += '</div>';
            });
            $('#dictionary').html(html);
        }).fail(function (jqXHR) {
            $('#dictionary').html('An error occurred: ' + jqXHR.status).append(jqXHR.responseText);
        });
    });
});